Denying...does not deny!


#1

Hello !

I’m making my teeth at the dom api, and beginning to see how to handle errors and cases.

I Noticed something which seems strange to me :

when the user denies authorization, the app is returned a authUri that looks valid.

for example :

start browser in mock routing, start web_api_playground. run “initialize”, then run “authorise”, but now DENY when asked , you get :

App was authorised and auth URI received: safe-bmV0Lm1haWRzYWZlLmFwaV9wbGF5Z3JvdW5kLndlYmNsaWVudC4xMA==:AQAAANddw6cAAAAAAQAAAAAAAAA=

I get the same with some homebrew test webapps.

I would expect the app would be rejected and no authUri would be sent ?


#2

That actually looks like a AuthDenied Message.

Unless the user chooses to “Ignore/Skip” the request, the app is notified of the users decision thereby it receiving a response. The part before : likely is the safe-<app-name> portion which is encoded and the rest is the actual content. If you pass the received url to the native libs via the decode ipc fns, then I’d assume that should return a result which indicates AuthDenied, which thereby should let the app know the user has failed to authorise this app request.


#3

ok, thank you @Viv that makes sense !

I tried to window.safeApp.connectAuthorised, despite having “DENYed” and got rejected :

Uncaught (in promise) Error: IPC error: AuthDenied

I still need to figure out how to , as you said, decode the response as a “AuthDenied” before actually trying to do something else. None of the examples that I saw seem to take care of this case.

EDIT : Or not ! We can just handle it when the error is thrown, so I mark this solved . thx ! :slight_smile:


#4

This topic was automatically closed after 60 days. New replies are no longer allowed.