{"id":23362895,"url":"https://github.com/remotesynth/kinvey-login-sample","last_synced_at":"2025-04-07T21:45:57.042Z","repository":{"id":69429848,"uuid":"117740372","full_name":"remotesynth/kinvey-login-sample","owner":"remotesynth","description":"A simple example showing anonymous, social and kinvey user authentication","archived":false,"fork":false,"pushed_at":"2018-02-12T15:11:17.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-13T23:18:15.622Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/remotesynth.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-16T20:52:14.000Z","updated_at":"2018-01-16T20:52:19.000Z","dependencies_parsed_at":"2023-04-07T04:33:22.242Z","dependency_job_id":null,"html_url":"https://github.com/remotesynth/kinvey-login-sample","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remotesynth%2Fkinvey-login-sample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remotesynth%2Fkinvey-login-sample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remotesynth%2Fkinvey-login-sample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remotesynth%2Fkinvey-login-sample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/remotesynth","download_url":"https://codeload.github.com/remotesynth/kinvey-login-sample/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247737602,"owners_count":20987717,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-21T12:33:25.490Z","updated_at":"2025-04-07T21:45:57.021Z","avatar_url":"https://github.com/remotesynth.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Login Sample Application built with Kinvey\n\nThis is a simple example demonstrating how to implement the following in [Kinvey](https://www.kinvey.com/):\n\n* Creating an implicit (anonymous) active user\n* Signing up and logging in with Kinvey authentication\n* Signing up and logging in with Google authentication\n* Restricting data access via roles\n\nThe code relies upon two custom endpoints in Kinvey:\n\n_addRole_\n\n```javascript\nfunction onRequest(request, response, modules) {\n  var context = modules.backendContext,\n      utils = modules.utils,\n      appKey = context.getAppKey(),\n      masterSecret = context.getMasterSecret(),\n      userid = request.body.userid,\n      roleid = request.body.roleid,\n      uri = 'https://baas.kinvey.com/user/' + context.getAppKey()+ '/' + userid + '/roles/' + roleid,\n      authString = \"Basic \" + utils.base64.encode(appKey + \":\" + masterSecret),\n      requestOptions = {\n        uri:uri, \n        headers: {\n          \"Authorization\":authString\n        }\n      },\n      auth;\n  \n\tauth = modules.request.put(requestOptions,function(error, res, body){\n\t\tif (error){\n\t\t\tresponse.error(error);\n\t\t} else {\n      response.body = JSON.parse(body);\n      response.complete(res.status);\n    }\n  });\n}\n```\n\n_deleteRole_\n\n```javascript\nfunction onRequest(request, response, modules) {\n  var context = modules.backendContext,\n      utils = modules.utils,\n      appKey = context.getAppKey(),\n      masterSecret = context.getMasterSecret(),\n      userid = request.body.userid,\n      roleid = request.body.roleid,\n      uri = 'https://baas.kinvey.com/user/' + context.getAppKey()+ '/' + userid + '/roles/' + roleid,\n      authString = \"Basic \" + utils.base64.encode(appKey + \":\" + masterSecret),\n      requestOptions = {\n        uri:uri, \n        headers: {\n          \"Authorization\":authString\n        }\n      },\n      auth;\n  \n\tauth = modules.request.del(requestOptions,function(error, res, body){\n\t\tif (error){\n\t\t\tresponse.error(error);\n\t\t} else {\n      response.body = \"{}\";\n      response.complete(res.status);\n    }\n  });\n}\n```\n\nA written guide explaining the code within the sample application is forthcoming.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremotesynth%2Fkinvey-login-sample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fremotesynth%2Fkinvey-login-sample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremotesynth%2Fkinvey-login-sample/lists"}