@@ -74,18 +74,34 @@ You will likely want to use an OAuth client library in your app to make interact
7474When initiating the auth flow for the user, you should use the ` Native\Mobile\Facades\Browser::auth() ` API, as this is
7575purpose-built for securely passing authorization codes back from the OAuth service to your app.
7676
77- You should set your redirect URL to ` nativephp://127.0.0.1/some/route ` , where ` some/route ` is a route you've defined in
78- your app's routes that will be able to handle the auth code.
77+ For this to work, you must set a ` NATIVEPHP_DEEPLINK_SCHEME ` that will be unique for your application on users' devices.
7978
80- Note that the scheme of the redirect URL in this case is ** always** ` nativephp:// ` . This has nothing to do with any
81- custom deep link scheme you may have set for your app. It is only tied to the ` Browser::auth() ` session.
79+ ``` dotenv
80+ NATIVEPHP_DEEPLINK_SCHEME=myapp
81+ ```
82+
83+ Then you must define your redirect URL. It should match your scheme and the route in your app that will handle the callback
84+ data.
85+
86+ ``` php
87+ Browser::auth('https://workos.com/my-company/auth?redirect=myapp://auth/handle')
88+ ```
89+
90+ Most services will expect you to pre-define your redirect URLs as a security feature. You should be able to provide your
91+ exact URL, as this will be the most secure method.
92+
93+ How you handle the response in your app depends on how that particular API operates and the needs of your application.
8294
8395<aside >
8496
85- Make sure you have good security around your auth service's authentication endpoint. As it will be accessed from many
86- devices via an API, standard browser security such as CSRF protections will not be available to you.
97+ #### Security
98+
99+ If you're running your own auth service, make sure you have good security around its authentication endpoint. As it
100+ will be accessed by unauthenticated from many devices via an API, standard browser security — such as CSRF protection —
101+ ** will not be available** to you.
87102
88- Ensure you have appropriate rate limiting in place and even consider using an authentication key that you distribute
89- with your apps. These steps will all help defend the endpoint against abuse.
103+ Ensure you have appropriate ** rate limiting** in place and even consider using an ** authentication key** that you
104+ distribute with your apps and is solely used to for accessing the authentication endpoint. These steps will all help
105+ defend the endpoint against abuse.
90106
91107</aside >
0 commit comments