All Projects → ionic-team → custom-auth-examples

ionic-team / custom-auth-examples

Licence: MIT license
No description, website, or topics provided.

Programming Languages

go
31211 projects - #10 most used programming language
javascript
184084 projects - #8 most used programming language
PHP
23972 projects - #3 most used programming language
python
139335 projects - #7 most used programming language
ApacheConf
554 projects

Ionic Platform Custom Auth Examples

These examples will get you up and running using Ionic Auth with your own server backend.

Examples are organized by web framework. Each example runs on port 5000 and defines a route, /auth, which is the entry point.

For these examples, we will be using the shared secret foxtrot and the endpoint http://localhost:5000/auth. These custom auth config options are specified in apps.ionic.io.

custom auth setup

Use the included nodejs script to generate the URL to start the authentication process.

$ node genurl.js <YOUR_APP_ID>

Boot up your preferred example. For nodejs:

$ node express/server.js

Copy the generated URL from the genurl.js script into curl or a tool like postman.

curl -L -X GET "<GENERATED_URL>"

The token (when successfully decoded) has the following payload, but you can alter genurl.js to change what gets sent to your server.

{
    "username": "dan",
    "password": "123"
}

Upon successful authentication, you should get a JSON response with the message You have successfully implemented custom authentication! in it.

Then you can look in your users list and see your authenticated, created user.

users list

Further documentation for custom authentication can be found here.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].