Tutorial - Login With Vevioz (Integrating Vevioz Sign-In into your web app) | Vevioz Community

Tutorial Login With Vevioz (Integrating Vevioz Sign-In into your web app)

DevOps

Linux Systems Engineer
Joined
Oct 18, 2019
Messages
149
Reaction score
14
Points
18
Location
Indonesia
Website
www.anymusics.com
Offline
Vevioz Sign-In manages the OAuth 2.0 flow and token lifecycle, simplifying your integration with Google APIs. A user always has the option to revoke access to an application at any time.

This document describes how to complete a basic Google Sign-In integration.

Create authorization credentials
Any application that uses OAuth 2.0 to access Google APIs must have authorization credentials that identify the application to Google's OAuth 2.0 server. The following steps explain how to create credentials for your project. Your applications can then use the credentials to access APIs that you have enabled for that project.

  1. Go to the Credentials page.
  2. Click Create credentials > OAuth client ID.
  3. Select the Web application application type.
  4. Name your OAuth 2.0 client and click Create
After configuration is complete, take note of the client ID that was created. You will need the client ID to complete the next steps. (A client secret is also created, but you need it only for server-side operations.)

Our API allows you to retrieve informations from our website via GET request and supports the following query parameters:

NameMeaningValuesDescriptionRequired
typeQuery type.get_user_data, posts_dataThis parameter specify the type of the query.
limitLimit of items.LIMITThis parameter specify the limit of items. Max:100 | Default:20

How to start?
  1. Create a development application.

  2. Once you have created the app, you'll get APP_ID, and APP_SECRET.
    Screenshot_24.png

  3. To start the Oauth process, use the link https://www.vevioz.com/oauth?app_id={YOUR_APP_ID}

  4. Once the end user clicks this link, he/she will be redirected to the authorization page.

  5. Once the end user authorization the app, he/she will be redirected to your domain name with a GET parameter "code", example: http://yourdomain/?code=XXX

  6. In your code, to retrieve the authorized user info, you need to generate an access code, please use the code below:
Code:
<?php
    $app_id = 'YOUR_APP_ID'; // your application app id
    $app_secret = 'YOUR_APP_SECRET'; your application app secret
    $code = $_GET['code']; // the GET parameter you got in the callback: http://yourdomain/?code=XXX

    $get = file_get_contents("https://www.vevioz.com/authorize?app_id={$app_id}&app_secret={$app_secret}&code={$code}");

    $json = json_decode($get, true);
    if (!empty($json['access_token'])) {
        $access_token = $json['access_token']; // your access token
    }
?>

Once you got the access code, simple call the data you would like to retrieve, Example:
Code:
if (!empty($json['access_token'])) {
    $access_token = $json['access_token']; // your access token
    $type = "get_user_data"; // or posts_data
    $get = file_get_contents("https://www.vevioz.com/app_api?access_token={$access_token}&type={$type}");
}
Respond:
Jsonoutput
{
    "api_status": "success",
    "api_version": "1.3",
    "user_data": {
        "id": "",
        "username": "",
        "first_name": "",
        "last_name": "",
        "gender": "",
        "birthday": "",
        "about": "",
        "website": "",
        "facebook": "",
        "twitter": "",
        "vk": "",
        "google+": "",
        "profile_picture": "",
        "cover_picture": "",
        "verified": "",
        "url": ""
    }
}
 
Top Bottom